home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / pctchnqs / 1990 / number6 / input.asm < prev    next >
Assembly Source File  |  1990-12-11  |  546b  |  16 lines

  1. ;  Listing 2.  INPUT.ASM.
  2. ;  The input() method as pure assembly language
  3.  
  4.    push  bp                  ; Create stack frame
  5.    mov   bp, sp
  6.    push  si                  ; Must save si register
  7.    mov   si, word ptr [bp+4] ; Point to object data with si
  8.    mov   ax, word ptr [bp+6] ; Load AX with i
  9.    add   word ptr [si],ax    ; sum += i
  10.    inc   word ptr [si+2]     ; n++
  11.    pop   si                  ; Restore si register
  12.    pop   bp                  ; Remove the stack frame
  13.    ret                       ; Return to caller
  14.  
  15.  
  16.